222 ◾ Bioinformatics
chp2=$(samtools view -c ENCFF000XJS_chp2_filt.bam)
fact2=$(echo “scale=6; $chp2/$inpc” | bc)
samtools view -b -s $fact2 ENCFF000XGP_inp0_filt.bam >
ENCFF000XGP_inp0_filt_inp2.bam
chp3=$(samtools view -c ENCFF000XKD_chp3_filt.bam)
fact3=$(echo “scale=6; $chp3/$inpc” | bc)
samtools view -b -s $fact3 ENCFF000XGP_inp0_filt.bam >
ENCFF000XGP_inp0_filt_inp3.bam
You can then double check the read count in the new control files for the ChIP-Seq files.
The read counts for control files are shown in Table 6.1.
samtools view -c ENCFF000XGP_inp0_filt_inp1.bam
samtools view -c ENCFF000XGP_inp0_filt_inp2.bam
samtools view -c ENCFF000XGP_inp0_filt_inp3.bam
Up to this point, we have three ChIP-Seq BAM files and three control BAM files, one for
each ChIP-Seq file. Before proceeding to the next step, you may decide to view the align-
ment in the BAM file with the “samtools tview” command or any other BAM viewing pro-
gram. When we use “samtools tview”, the “-p” option is used to specify a specific position.
To view a BAM file, you need to sort the alignments by coordinate and then index it. As an
example, we will view only one file (Figure 6.3).
samtools sort ENCFF000XJP_chp1_filt.bam -o
ENCFF000XJP_chp1_filt_so.bam
samtools index ENCFF000XJP_chp1_filt_so.bam
samtools tview \
FIGURE 6.3 Visualizing reads aligned to the reference genome using “samtools tview” command.